using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chapter8
{
    public abstract class Shape
    {
        public abstract double GetArea();

    }
    public   class Rectangle : Shape
    {
        double width, height;
        public Rectangle() { }
        public Rectangle(double width, double height)
        {
            this.width = width;
            this.height = height;
        }
        public sealed override double GetArea()
        {
            return   width * height;
        }
    }
    
    public class Square : Rectangle
    {
        double width;

        public Square(double width)
        {
            this.width = width;
        }

        //public  override    double  GetArea()
        //{
        //    return width * width;
        //}

        public new double GetArea()
        {
            return width * width;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            

            Square s = new Square(3);
            Console.WriteLine("正方形面积={0}",s.GetArea());
            Rectangle r = new Rectangle(3, 4);
            Console.WriteLine("大的长方形的面积={0}",r.GetArea());

         

          

        }
    }



}